<?php
abstract class Logger_Appender_Abstraction
{
    protected $_options =    array(
    'buffer'=>0,
    );
    protected $_name;
    protected $_closed      = false;
    /**
     * @var Logger_Layout_Abstraction
     */
    protected $_layout      = null;
    protected $_maxBuffer   = 0;
    protected $_bufferSize  = 0;
    protected $_logBuffer   = array();
    public function __construct ($name)
    {
        $this->_name = $name;
    }
    public function __destruct ()
    {   if($this->_bufferSize>0)
        $this->_flush();
    }
    public function getName ()
    {
        return $this->_name;
    }
    public function setOptions (array $options)
    {
        foreach ($options as $name => $value) {
            if (isset($this->_options[$name]))
                $this->_options[$name] = $value;
        }
    }
    public function setLayout (Logger_Layout_Abstraction $layout)
    {
        $this->_layout = $layout;
    }
    /**
     * @return Boolean
     */
    public function doAppender (Logger_Event $event)
    {
        if ($this->_closed)
            return false;
        $this->_append($event);
        return true;
    }
    abstract protected function _append (Logger_Event $event);
    abstract protected function _flush ();
    abstract protected function _close ();
}
?>